package com.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.entity.Title_List;
import com.util.JdbcUtil;
public class ExamDaoImpl implements IExamDao {
	public List<Title_List> takeExam(){
		Connection con=null;
		PreparedStatement ps = null;
		ResultSet rs = null;
		List<Title_List> textpapers=new ArrayList<Title_List>();
		try{
		String sql="select * from title_list where title_id=?";
		con.prepareStatement(sql);
		ps.setInt(1,846);
		ps.execute();
		if(rs.next()){
		Title_List textpaper=new Title_List(rs.getInt("title_id"),rs.getString("title_text"),rs.getInt("title_level"),rs.getString("title_major"),rs.getString("title_option_a"),rs.getString("title_option_b"),rs.getString("title_option_c"),rs.getString("title_option_d"),rs.getString("title_explain"),rs.getInt("title_type"),rs.getInt("title_status"),rs.getString("title_answer"));
		textpapers.add(textpaper);
		
		}
		} /*catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}*/ catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			JdbcUtil.close(rs, ps, con);
		}
		return textpapers;
		
		}
		
		
		
	}


